﻿using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Wslzy.Auxiliary.Infrastructure.Datas.EF.Core;
using Wslzy.Auxiliary.Infrastructure.Domains;

namespace Wslzy.Auxiliary.Infrastructure.Datas.EF.SqlServer
{
    /// <summary>
    /// 实体映射配置
    /// </summary>
    /// <typeparam name="TEntity">实体类型</typeparam>
    public abstract class EntityMap<TEntity> : MapBase<TEntity>, IMap where TEntity : class,IVersion
    {
        /// <summary>
        /// 映射乐观离线锁
        /// </summary>
        protected override void MapVersion(EntityTypeBuilder<TEntity> builder)
        {
            builder.Property(t => t.Version).IsRowVersion();
        }
    }
}
